package com.effectiv.gooruda.rest.api.operation;


import java.util.List;

import javax.ws.rs.core.MediaType;

import com.effectiv.gooruda.rest.api.domain.Role;
import com.effectiv.gooruda.rest.docs.core.annotation.Api;
import com.effectiv.gooruda.rest.docs.core.annotation.ApiBodyObject;
import com.effectiv.gooruda.rest.docs.core.annotation.ApiHeader;
import com.effectiv.gooruda.rest.docs.core.annotation.ApiHeaders;
import com.effectiv.gooruda.rest.docs.core.annotation.ApiMethod;
import com.effectiv.gooruda.rest.docs.core.annotation.ApiParam;
import com.effectiv.gooruda.rest.docs.core.annotation.ApiResponseObject;
import com.effectiv.gooruda.rest.docs.core.pojo.ApiVerb;
@Deprecated
@Api(name = "Role API", description = "Role management API.")
public interface RoleOperations {
	@ApiMethod(path = "/api/role", verb = ApiVerb.POST, description = "Save a role.", 
			produces = { MediaType.APPLICATION_JSON }, consumes = { MediaType.APPLICATION_JSON })
	@ApiHeaders(headers = {
			@ApiHeader(name = "signature", description = "Authentication signature."),
			@ApiHeader(name = "public-key", description = "Public key of the application.") })
	@ApiResponseObject
	Role save(@ApiBodyObject Role role);
	
	
	@ApiMethod(path = "/api/role/findbyname/{roleName}", verb = ApiVerb.GET, 
			description = "Retrieves a role by role name.", produces = { MediaType.APPLICATION_JSON }, consumes = { MediaType.APPLICATION_JSON })
	@ApiHeaders(headers = {
			@ApiHeader(name = "signature", description = "Authentication signature."),
			@ApiHeader(name = "public-key", description = "Public key of the application.") })	
	@ApiResponseObject
	Role findByName(@ApiParam(name = "roleName", required = true, description = "Role name.")  String roleName);
	
	
	@ApiMethod(path = "/api/role/findone/{id}", verb = ApiVerb.GET, 
			description = "Retrieves a role by id.", produces = { MediaType.APPLICATION_JSON }, consumes = { MediaType.APPLICATION_JSON })
	@ApiHeaders(headers = {
			@ApiHeader(name = "signature", description = "Authentication signature."),
			@ApiHeader(name = "public-key", description = "Public key of the application.") })	
	@ApiResponseObject
	Role findOne(@ApiParam(name = "id", required = true, description = "Role Id.") String id);
	
	
	@ApiMethod(path = "/api/role/addpermission/{roleName}/{permission}", verb = ApiVerb.GET, 
			description = "Adds a permission to an existing role.", produces = { MediaType.APPLICATION_JSON }, consumes = { MediaType.APPLICATION_JSON })
	@ApiHeaders(headers = {
			@ApiHeader(name = "signature", description = "Authentication signature."),
			@ApiHeader(name = "public-key", description = "Public key of the application.") })	
	@ApiResponseObject
	Role addPermission(
			@ApiParam(name = "roleName", required = true, description = "Role name.")  String roleName, 
			@ApiParam(name = "permission", required = true, description = "Permission details.")  String permission);
	
	@ApiMethod(path = "/api/role/addpermissions/{roleName}", verb = ApiVerb.GET, 
			description = "Adds a permission to an existing role.", produces = { MediaType.APPLICATION_JSON }, consumes = { MediaType.APPLICATION_JSON })
	@ApiHeaders(headers = {
			@ApiHeader(name = "signature", description = "Authentication signature."),
			@ApiHeader(name = "public-key", description = "Public key of the application.") })	
	@ApiResponseObject
	Role addPermissions(@ApiParam(name = "roleName", required = true, description = "Role name.")  String roleName, 
			@ApiBodyObject List<String> permissions);
	
}
